package com.me.collector;

import java.awt.Font;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;

public class ScoreCalculator {
	
	private int currentScore;
	private boolean scoreChanged;

	private Color green;
	private Color red;

	BitmapFont bitmapFont;
	 
	public ScoreCalculator(int startScore){
	
	currentScore = startScore;
	scoreChanged = false;
	bitmapFont = new BitmapFont();
	bitmapFont.setScale(1.2f);
	green = new Color(0,153,0, 1.0f);
	red = new Color(255,0,0, 1.0f);
	
	}
	
	private Color getColor()
	{
		Color currentColor;
		
		if(currentScore >= 0)
		{
			currentColor = green;
		}
		else
		{
			currentColor = red;
		}
		
		return currentColor;
	}
	
	public void addScore(int value)
	{
		currentScore = currentScore + value;
		scoreChanged = true;
	}
	
	public void draw(SpriteBatch batch) 
	{
		bitmapFont.setColor(getColor());

		bitmapFont.draw(batch, Integer.toString(currentScore), 10, Definitions.SCREEN_HEIGHT - 20);
	}
}
